<template>
  <div>
    <div class="topbig">
      <p class="cha">&emsp;&emsp;查询</p>
      <div class="sou">
        &emsp;&emsp;&emsp;&emsp;搜索&emsp;<el-input v-model="input" placeholder="输入菜品名称进行搜索" class="shuru" @blur="mohusousuo()"></el-input>
       </div>
    </div>

    <div class="main">
      <p class="caipin">&emsp;&emsp;库存盘点</p>
      <el-button type="primary" @click="xinzeng()">新增盘点单</el-button
      >&emsp;&emsp;
    </div>

    <el-table :data="tableData" border style="width: 100%">
      <el-table-column prop="foodId" label="菜品编号" width="180">
      </el-table-column>
      <el-table-column prop="sortId" label="菜品类型" width="180">
      </el-table-column>
      <el-table-column prop="adminId" label="负责员工"> </el-table-column>
      <el-table-column prop="inventoryPdate" label="盘点时间" width="180">
      </el-table-column>
      <el-table-column prop="name" label="审核管理员" width="180">
      </el-table-column>
      <el-table-column prop="inventorySdate" label="审核时间"> </el-table-column>
      <el-table-column prop="inventoryNote" label="备注" width="180"> </el-table-column>
      <el-table-column prop="caozuo" label="操作">
        <el-button @click="shenhe()">审核</el-button>
      </el-table-column>
    </el-table>
    
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage4"
      :page-sizes="[100, 200, 300, 400]"
      :page-size="100"
      layout="total, sizes, prev, pager, next, jumper"
      :total="400">
    </el-pagination>

    <div class="first" v-show="bool">
      <div class="firsttop">
        <p>&emsp;&emsp;菜品盘点单</p>
        <div class="topright">
          <button @click="fanhui()">返回</button>
          <button @click="baocun()">保存</button>&emsp;&emsp;
        </div>
      </div>
      <div class="firstcenter">
        &emsp;&emsp;&emsp;&emsp;制单人&emsp;&emsp;
        <p class="p1">李思思</p>
        &emsp;&emsp;&emsp;&emsp;制单时间&emsp;&emsp;
        <p class="p1">2023-5-15</p>
        &emsp;&emsp;&emsp;&emsp;审核人&emsp;&emsp;<el-select
          v-model="select"
          slot="prepend"
          placeholder="管理员">
        
          <el-option label="管理员1" value="1"></el-option>
          <el-option label="管理员2" value="2"></el-option>
        </el-select>
      </div>
      <div class="firstbottom">
        <el-table :data="tableData" border style="width: 100%">
          <el-table-column prop="xuhao" label="序号" >
          </el-table-column>
          <el-table-column prop="name" label="菜品编号" >
          </el-table-column>
          <el-table-column prop="address" label="菜品名称"> </el-table-column>
          <el-table-column prop="date" label="菜品单位" >
          </el-table-column>
          <el-table-column prop="name" label="系统库存" >
          </el-table-column>
          <el-table-column prop="address" label="实际库存"> </el-table-column>
          <el-table-column prop="date" label="库存出入" >
          </el-table-column>
          <el-table-column prop="" label="备注">
          </el-table-column>
          <el-table-column  label="操作">
            <button @click="add()">添加</button>
            </el-table-column>
        </el-table>

            <div class="second" v-show='bool2'>
                <div class="secondtop">&emsp;&emsp;菜品库存</div>
                    <div class="secondcenter">
                       <input class="secondinput" type="text" placeholder="可输入菜品名称查询" >
                    </div>
                <div class="secondbottom">
                    <div class="bottomleft">
                        <p class="leibie">菜品类别</p>
                        <p @click="chaocai()">炒菜</p>
                        <p @click="zhengcai()">凉菜</p>
                        <p @click="yingliao()">饮料</p>
                        <p @click="tang()">汤</p>
                    </div>
                    <div class="secondright">
                        <div class="rightsmall" v-for='(v) in list' :key="v.foodName">
                           <img :src="v.foodPic" alt=""><br>
                           菜品名称：{{v.foodName}} <br> 库存：{{v.foodNum}}
                        </div>
                    </div>
                </div>
                <div class="secondfoot">
                    <button @click="queding()">确定</button>&emsp;&emsp;&emsp;&emsp;
                    <button @click='quxiao()'>取消</button>
                </div>
            </div>
      </div>
    </div>
  </div>



</template>

<script>
import {findAllFoodByLimit} from "@/apis/ningsh/ningsh.js";
export default {
  data() {
    return {
      currentPage: 1,
       input: '',
      select: "",
      bool: false,
      bool2:false,
      tableData: [
        {},
      ],
      list:[{}],
    };
  },
  methods: {
   mohusousuo(){
      //input模糊查询
        // findlikelimit(this.input).then((ok)=>{
        //   console.log(ok);
        //   this.tableData=ok.data.data.records
          
        // })
    },

    xinzeng() {
      this.bool = true;
    },
    fanhui() {
      this.bool = false;
    },
    baocun(){
        this.bool=false;
    },
    add(){
        this.bool2=true;
        findAllFoodByLimit().then((ok)=>{
          console.log(ok);
          this.list=ok.data.data.records
        })
    },
    queding(){
        this.bool2=false;
    },
    quxiao(){
        this.bool2=false;
    },
    chaocai(){

    },
    zhengcai(){

    },
    shenhe(){
        
    },

     handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
      }
  },
 
};
</script>

<style scoped>
.topbig {
  width: 100%;
  height: 145px;
  border: 1px solid #ccc;
}
.cha {
  display: flex;
  align-items: center;
  height: 45%;
  background-color: #ccc;
}
.sou {
  font-size: 10px;
  height: 55%;
  display: flex;
  align-items: center;
}
.shuru{
  width: 300px;
}
.main {
  margin-top: 10px;
  margin-bottom: 10px;
  background-color: #ccc;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.caipin {
  width: 100%;
  display: flex;
  align-items: center;
  height: 60px;
}

.el-button {
  width: 100px;
  height: 40px;
}
.first {
  width: 80%;
  height: 80%;
  background-color: white;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  margin: auto;
  border: 2px solid blue;
}
.firsttop {
  height: 50px;
  border: 1px solid #ccc;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.topright {
  width: 100px;
  display: flex;
  justify-content: space-between;
}
.firstcenter {
  height: 100px;
  display: flex;
  align-items: center;
}
.p1 {
  width: 100px;
  height: 40px;
  background-color: #ccc;
  line-height: 40px;
  text-align: center;
}
.firstbottom{
    display: flex;
    width: 95%;
    margin: auto;
}
.second{
    width: 60%;
    height: 90%;
    background-color: rgb(241, 239, 239);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
    border: 2px solid blue;
}
.secondtop{
    height: 50px;
    background-color: #ccc;
    line-height: 50px;
}
.secondinput{
    width: 100%;
    height: 30px;
    border: 1px solid #ccc;
    border-radius: 15px 15px;
    margin: 10px auto;
    text-align: center;
}
.secondbottom{
    display: flex;
    height: 80%;
    
}
.bottomleft>p{
    width: 150px;
    height: 30px;
    text-align: center;
     border: 1px solid black;
}
.leibie{
    background-color: #ccc;
}
.secondright{
    width: 78%;
    height: 80%;
    border: 1px solid black;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    overflow: scroll;
}
::-webkit-scrollbar {
 display: none;
}
.rightsmall{
    width: 31%;
    height: 45%;
    border: 1px solid red;
    margin: 5px 10px 0 0;
}
.rightsmall>img{
  height: 70%;
  width: 70%;
}
.secondfoot{
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: -50px;
}
</style>